package com.baidu.track.activity;

import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * Created by Tabjin on 2017/10/11/011.
 */

public class Alarm {
/*    public static void invokeTimerPOIService(Context context){
        Log.i("ServiceUtil-AlarmManage", "invokeTimerPOIService wac called.." );
        PendingIntent alarmSender = null;
//        Intent startIntent = new Intent(context, UploadPOIService.class);
        startIntent.setAction("POI-SERVICE");
        try {
            alarmSender = PendingIntent.getService(context, 0, startIntent, PendingIntent.FLAG_UPDATE_CURRENT);
        } catch (Exception e) {
//            Log.i("ServiceUtil-AlarmManager", "failed to start " + e.toString());
        }
        AlarmManager am = (AlarmManager) context.getSystemService(Activity.ALARM_SERVICE);
        am.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 30000, alarmSender);
    }

    public static void cancleAlarmManager(Context context){
        Log.i("ServiceUtil-AlarmManage", "cancleAlarmManager to start ");
//        Intent intent = new Intent(context,UploadPOIService.class);
        intent.setAction("POI-SERVICE");
        PendingIntent pendingIntent=PendingIntent.getService(context, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT);
        AlarmManager alarm=(AlarmManager)context.getSystemService(Activity.ALARM_SERVICE);
        alarm.cancel(pendingIntent);
    }*/
}
